<template>
	<view class="order-detail">
		<y-cubar :isFixed="true" title="待确认" :bgColor="`rgba(255,255,255,${opacity})`" />
		<view class="order-detail-bg"></view>
		<view class="con">
			<view class="status">
				用户已下单,请尽快确认~
			</view>
			<view class="card">
				<view class="title">车辆信息</view>
				<view class="car-info">
					<image src="/static/sucai/car.png" mode="aspectFill"></image>
					<view class="info">
						<view class="name">比亚迪 秦PLUS </view>
						<view class="desc">
							<text>2021款</text>
							<text>DM-i 纯电动尊享版</text>
						</view>
						<view class="tags">
							<view class="tag">纯电动</view>
							<view class="tag">430km</view>
							<view class="tag">全新</view>
							<view class="tag">0.5h</view>
						</view>
					</view>
				</view>
				<view class="grid">
					<view class="grid-item">
						<view class="value">
							<text>3</text>
							<text>个月</text>
						</view>
						<view class="label">期数</view>
					</view>
					<view class="grid-item">
						<view class="value">
							<text>2989</text>
							<text>元/月</text>
						</view>
						<view class="label">价格</view>
					</view>
					<view class="grid-item">
						<view class="value">
							<text>8000</text>
							<text>元</text>
						</view>
						<view class="label">押金(可退)</view>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="title">租赁人信息</view>
				<view class="enum">
					<view class="cell">
						<view class="label">上门地址</view>
						<view class="value">浙江省金华市杭州市鼓楼区科技软件园商务城座888号</view>
					</view>
					<view class="cell">
						<view class="label">联系人</view>
						<view class="value">租赁人信息</view>
					</view>
					<view class="cell">
						<view class="label">联系电话</view>
						<view class="value">16767899997</view>
					</view>
					<view class="cell">
						<view class="label">合同</view>
						<view class="value ht">查看</view>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="title">分期信息</view>
				<view class="fenqi">
					<view class="fenqi-item">
						<view class="top">
							<text>首期</text>
							<text>2367元</text>
						</view>
						<view class="bottom">
							<text>2023-08-01</text>
							<text>已支付</text>
						</view>
					</view>
					<view class="fenqi-item">
						<view class="top">
							<text>2期</text>
							<text>2367元</text>
						</view>
						<view class="bottom">
							<text>2023-08-01</text>
							<text>已支付</text>
						</view>
					</view>
					<view class="fenqi-item">
						<view class="top">
							<text>3期</text>
							<text>2367元</text>
						</view>
						<view class="bottom">
							<text>2023-08-01</text>
							<text>已支付</text>
						</view>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="title">订单信息</view>
				<view class="enum">
					<view class="cell">
						<view class="label">订单编号</view>
						<view class="value">56765867978945345367</view>
					</view>
					<view class="cell">
						<view class="label">提取服务</view>
						<view class="value">送货上门</view>
					</view>
					<view class="cell">
						<view class="label">下单时间</view>
						<view class="value">2023-07-15 15:09:09</view>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="title">押金信息</view>
				<view class="enum">
					<view class="cell">
						<view class="label">押金金额</view>
						<view class="value">¥8000</view>
					</view>
					<view class="cell">
						<view class="label">扣除项</view>
						<view class="value">这里是原因</view>
					</view>
					<view class="cell">
						<view class="label">扣除项凭证</view>
						<view class="img">
							<image src="../../static/logo.png" mode="aspectFill"></image>
						</view>
					</view>
					<view class="cell">
						<view class="label">退款编号</view>
						<view class="value">1046840596840568405</view>
					</view>
					<view class="cell">
						<view class="label">退款时间</view>
						<view class="value">2023-07-15 15:09:09</view>
					</view>
				</view>
			</view>
		</view>
		<view class="action-bottom">
			<button class="cu-btn">确认</button>
			<button class="cu-btn cu-btn-a">联系用户</button>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		onPageScroll
	} from "@dcloudio/uni-app";
	import YCubar from '@/components/y-cubar/index.vue'

	const opacity = ref(0)
	onPageScroll((e) => {
		const childerOpa = Number((e.scrollTop / 200).toFixed(2))
		opacity.value = childerOpa >= 1 ? 1 : childerOpa
	})
</script>

<style lang="scss" scoped>
	.order-detail {
		min-height: 100vh;
		background-color: #F5F5F5;

		padding-bottom: 150rpx;
		padding-bottom: calc(constant(safe-area-inset-bottom) + 150rpx);
		padding-bottom: calc(env(safe-area-inset-bottom) + 150rpx);

		&-bg {
			width: 750rpx;
			height: 408rpx;
			background: linear-gradient(180deg, #F7C241 0%, #F5F5F5 100%);
			position: absolute;
			top: 0;
		}

		.con {
			position: relative;
			z-index: 3;
			padding: 24rpx;

			.status {
				text-align: center;
				font-size: 30rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #333333;
			}
		}

		.card {
			width: 702rpx;
			margin: 30rpx auto 0 auto;
			box-sizing: border-box;
			background-color: #fff;
			border-radius: 16rpx;
			padding: 24rpx;

			.title {
				font-size: 32rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #333333;
			}

			.car-info {
				margin-top: 24rpx;
				display: flex;
				align-items: center;

				image {
					width: 160rpx;
					height: 160rpx;
					border-radius: 16rpx;
				}

				.info {
					flex: 1;
					margin-left: 24rpx;

					.name {
						font-size: 30rpx;
						font-family: PingFang SC-Bold, PingFang SC;
						font-weight: bold;
						color: #333333;
					}

					.desc {
						margin-top: 8rpx;
						font-size: 24rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #999999;
					}

					.tags {
						margin-top: 14rpx;
						display: flex;

						.tag {
							font-size: 24rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #999999;
							padding: 6rpx 12rpx;
							background: #F5F5F5;
							border-radius: 4rpx;

							&:not(:first-child) {
								margin-left: 8rpx;
							}
						}
					}
				}
			}

			.grid {
				margin-top: 32rpx;
				background: #F8F8F8;
				border-radius: 16rpx;
				padding: 32rpx 40rpx;
				display: flex;
				justify-content: space-between;

				&-item {
					.value {
						text {
							font-size: 24rpx;
							font-family: PingFang SC-Regular, PingFang SC;
							font-weight: 400;
							color: #FF4E00;

							&:first-child {
								font-size: 32rpx;
							}
						}
					}

					.label {
						margin-top: 10rpx;
						font-size: 26rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #666666;
					}
				}
			}

			.enum {
				margin-top: 24rpx;

				.cell {
					display: flex;
					justify-content: space-between;

					&:not(:first-child) {
						margin-top: 32rpx;
					}

					.label {
						font-size: 30rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #999999;
					}

					.value {
						flex: 1;
						margin-left: 40rpx;
						font-size: 30rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #333333;
						text-align: right;
					}

					.img {
						image {
							width: 144rpx;
							height: 144rpx;
						}
					}

					.type {
						color: #F57B01;
					}

					.ht {
						color: #2758E7;
					}
				}
			}

			.fenqi {
				&-item {
					padding: 26rpx;
					border-bottom: 1rpx solid #eee;

					.top {
						display: flex;
						align-items: center;
						justify-content: space-between;
						font-size: 28rpx;
						font-family: PingFang SC-Medium, PingFang SC;
						font-weight: 500;
						color: #333333;
					}

					.bottom {
						margin-top: 8rpx;
						display: flex;
						align-items: center;
						justify-content: space-between;

						text {
							color: #999999;

							&:last-child {
								color: #27C485;
							}
						}
					}
				}
			}
		}

		.action-bottom {
			position: fixed;
			bottom: 0;
			z-index: 3;
			width: 750rpx;
			background-color: #fff;
			padding: 18rpx 24rpx;
			box-shadow: 0rpx -2rpx 12rpx 2rpx rgba(0, 0, 0, 0.03);
			padding-bottom: 18rpx;
			padding-bottom: calc(constant(safe-area-inset-bottom) + 18rpx);
			padding-bottom: calc(env(safe-area-inset-bottom) + 18rpx);
			display: flex;
			justify-content: flex-end;

			.cu-btn {
				width: 192rpx;
				height: 74rpx;
				background: #F5F5F5;
				border-radius: 16rpx;
				font-size: 30rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #333333;
				margin: 0;

				&:not(:last-child) {
					margin-right: 20rpx;
				}

				&-a {
					background: #FFC434;
					color: #333333;
				}
			}
		}
	}
</style>